<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	http://www.springframework.org/schema/context
	http://www.springframework.org/schema/context/spring-context-3.0.xsd">
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<value>/WEB-INF/jdbc.properties</value>
			</list>
		</property>
	</bean>
	<!-- A Local dataSource Definition using c3p0 connection pool -->
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close">
		<property name="driverClass" value="${connection.driver_class}" />
		<property name="jdbcUrl" value="${jdbc.connection.url}" />
		<property name="idleConnectionTestPeriod"
			value="${jdbc.pool.c3p0.idle_connection_test_period}" />
		<property name="preferredTestQuery" value="${jdbc.pool.c3p0.preferred_test_query}" />
		<property name="maxIdleTime" value="${jdbc.pool.c3p0.max_idle_time}" />
		<property name="properties">
			<props>
				<prop key="user">${jdbc.connection.username}</prop>
				<prop key="password">${jdbc.connection.password}</prop>
				<prop key="c3p0.acquire_increment">${jdbc.pool.c3p0.acquire_increment}</prop>
				<prop key="c3p0.max_size">${jdbc.pool.c3p0.max_size}</prop>
				<prop key="c3p0.min_size">${jdbc.pool.c3p0.min_size}</prop>
			</props>
		</property>
	</bean>
	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
		<property name="cacheQueries">
			<value>true</value>
		</property>
	</bean>
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="packagesToScan">
			<list>
				<value>com/eop/entity/</value>
				<value>com/sso/entity/</value>
			</list>
		</property>

		<property name="annotatedClasses">
			<list>
				<!-- 源数据 
				 任务 -->
				<value>com.base.task.entity.Task</value>

				 <!-- 组织结构 --> 
				<value>com.base.organization.entity.BusinessLine</value>
				<value>com.base.organization.entity.CentralUnit</value>
				<value>com.base.organization.entity.DepartmentalUnit
				</value>
				<value>com.base.organization.entity.DepartmentAndPerson
				</value>
				<value>com.base.organization.entity.DepartmentBusiness
				</value>
				<value>com.base.organization.entity.DepartmentManagement
				</value>
				<value>com.base.organization.entity.Employee</value>
				<value>com.base.organization.entity.Position</value>
				
				<value>com.base.security.entity.Resource</value>
				<value>com.base.security.entity.RoleResource</value>
				<value>com.base.security.entity.SecurityGroup</value>
				<value>com.base.security.entity.SecurityRole</value>
				<value>com.base.security.entity.SecurityUser</value>
				<value>com.base.security.entity.UserRole</value>
				<value>com.base.security.entity.UserGroup</value>
				<value>com.base.security.onlineuser.entity.OnlineUser
				</value>
				<value>com.base.security.onlineuser.entity.MaxOnlineUser
				</value>
				<value>com.base.security.license.entity.KRPLicenseConfig
				</value>
				<!-- 附件 -->
				<value>com.base.attachment.entity.Attachment</value>
				<!-- 配置项 -->
				<value>com.base.commonKey.entity.CommonKey</value>
				<value>com.base.commonKey.entity.CommonKeyType</value>
				</list>
		</property>
	</bean>
	<!-- Transaction manager for a single JDBC DataSource -->
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean> 
	<!--  Transaction interceptor  -->
	<bean id="transactionInterceptor"
		class="org.springframework.transaction.interceptor.TransactionInterceptor">
		<property name="transactionManager" ref="transactionManager" />
		<property name="transactionAttributes">
			<props>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	<!-- BeanName auto proxy to define the interceptor -->
	<bean
		class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
		<property name="beanNames">
			<list>
				<value>*DAO</value>
				<value>*Dao</value>
				<value>*Service</value>
			</list>
		</property>
		<property name="interceptorNames">
			<list>
				<value>transactionInterceptor</value>
			</list>
		</property>
	</bean>
</beans>